var webpack = require('webpack');
var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
    //插件项
    plugins: [commonsPlugin],
    //页面入口文件配置
    entry: {
        lodin: './js/controllers/lodin.js',
        apply: './js/controllers/apply.js',
        forgotPassword: './js/controllers/forgotPassword.js',
        spending: './js/controllers/spending.js',
        staffHome: './js/controllers/staffHome.js',
        accountInquiry: './js/controllers/accountInquiry.js',
        tradeDetail: './js/controllers/tradeDetail.js',
        userSettings: './js/controllers/userSettings.js',
        changePhone: './js/controllers/changePhone.js',
        changePassword: './js/controllers/changePassword.js',
        managerHome: './js/controllers/managerHome.js',
        fillInformation: './js/controllers/fillInformation.js',
        photo: './js/controllers/photo.js',
        storePhotos: './js/controllers/storePhotes.js',
        success: './js/controllers/success.js',
        error: './js/controllers/error.js',
        merchantHome: './js/controllers/merchantHome.js',
        orderDetail: './js/controllers/orderDetail.js',
        setRate: './js/controllers/setRate.js',
        takeMoney: './js/controllers/takeMoney.js',
        staffRecord: './js/controllers/staffRecord.js',
         orderDetail2: './js/controllers/orderDetail2.js',
    },
    //入口文件输出配置
    output: {
        path: './dist/js/tltd',
        filename: '[name].min.js'
    },
    module: {
        //加载器配置
        loaders: [
            //.css 文件使用 style-loader 和 css-loader 来处理
            {
                test: /\.css$/,
                loader: 'style-loader!css-loader'
            },
            //.js 文件使用 jsx-loader 来编译处理
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                loader: 'babel'
            },
            //.scss 文件使用 style-loader、css-loader 和 sass-loader 来编译处理
            //            { test: /\.scss$/, loader: 'style!css!sass?sourceMap'},
            //图片文件使用 url-loader 来处理，小于8kb的直接转为base64
            {
                test: /\.(png|jpg)$/,
                loader: 'url-loader?limit=8192'
            }
        ]
    },
    resolve: {
        //查找module的话从这里开始查找
        root: 'F:/caiWork/mobileWeb/instalments', //绝对路径
        //自动扩展文件后缀名，意味着我们require模块可以省略不写后缀名
        extensions: ['', '.js', '.json', '.scss'],
        //模块别名定义，方便后续直接引用别名，无须多写长长的地址
        alias: {
            //            iscrollAssist : path.join('js/iscrollAssist.js'),//后续直接 require('iscrollAssist') 即可
        }
    }
}